package com.zhazha.stand.controller;

import com.opensymphony.xwork2.ActionContext;
import com.zhazha.stand.entity.User;
import com.zhazha.stand.logic.impl.DepartmentLogicImpl;
import com.zhazha.stand.logic.impl.LoginLogicImpl;
import com.zhazha.stand.logic.impl.UserLogicImpl;
import com.zhazha.stand.controller.BaseController;

public class LoginController extends BaseController{
	
	private LoginLogicImpl loginLogic = new LoginLogicImpl();
	private User user = null;
	
	public String login() {
		String username = this.getStringParam("username");
		String department = this.getStringParam("department");
		int grd = this.getIntParam("grd");
		int contestId = this.getIntParam("contestId");
		
		if (null == loginLogic.validateLogin(username, department, grd, contestId))
			return ERROR;
		ActionContext.getContext().put("user", user);
		return SUCCESS;
	}
}
